package com.xianggg.xservers.weixin.sdk.vo;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.xianggg.xservers.weixin.sdk.type.MsgType;
import com.xianggg.xservers.weixin.sdk.type.XStreamCDATA;

@XStreamAlias("xml")
public class OutputBaseMsg {
    @XStreamAlias("ToUserName")
    @XStreamCDATA
    private String toUserName;

    @XStreamAlias("FromUserName")
    @XStreamCDATA
    private String fromUserName;

    @XStreamAlias("CreateTime")
    private Long createTime;

    @XStreamAlias("MsgType")
    @XStreamCDATA
    private String msgType = "text";

    public OutputBaseMsg() {
    }

    public OutputBaseMsg(String toUserName, String fromUserName, MsgType msgType) {
        this.toUserName = toUserName;
        this.fromUserName = fromUserName;
        this.createTime = System.currentTimeMillis()/1000;
        this.msgType = msgType.name();
    }

    public OutputBaseMsg(InputMsg inputMsg,MsgType msgType) {
        this(inputMsg.getFromUserName(),inputMsg.getToUserName(),msgType);
    }

    public String getToUserName() {
        return toUserName;
    }

    public void setToUserName(String toUserName) {
        this.toUserName = toUserName;
    }

    public String getFromUserName() {
        return fromUserName;
    }

    public void setFromUserName(String fromUserName) {
        this.fromUserName = fromUserName;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public String getMsgType() {
        return msgType;
    }

    public void setMsgType(String msgType) {
        this.msgType = msgType;
    }
}
